<?php

namespace App\Http\Resources\Counter;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class TableAlertResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        $tableData = parent::toArray($request);

        return [
            'table' => $tableData,
            'alert_date' => $this->alert_date->format('Y-m-d H:i:s'),
            'table_name' => $this->getName(),
        ];
    }
}
